package net.esj.basic.core.engine.support.translator;

import java.util.Collection;


/**
 * 对象转换接口,将命名一致的属性从对象A复制到对象B，当类型不一致时可能导致异常
 * @author Administrator
 *
 */
public interface Translator {

	/**
	 * 正向转换
	 * @param source
	 * @param targetClass
	 * @return
	 * @throws TranslateException
	 */
	Object translate(Object source,Class targetClass) throws TranslateException;

	Collection translateCollection(Collection collections,Class targetClass) throws TranslateException;
	
	Object[] translateArray(Object[] objs,Class targetClass) throws TranslateException;
	
	/**
	 * 逆转换
	 * @param source
	 * @param targetClass
	 * @return
	 * @throws TranslateException
	 */
	Object retrans(Object source,Class targetClass) throws TranslateException;
	
	Collection retransCollection(Collection collections,Class targetClass) throws TranslateException;
	
	Object[] retransArray(Object[] objs,Class targetClass) throws TranslateException;

	
}
